package com.example.todoapp.config;
import com.example.todoapp.data.entities.Tag;
import com.example.todoapp.data.TagRepository;
import jakarta.annotation.PostConstruct;
import org.springframework.context.annotation.Configuration;

import java.time.LocalDateTime;

@Configuration
public class DataInitializer {
    private final TagRepository tagRepository;

    public DataInitializer(TagRepository tagRepository) {
        this.tagRepository = tagRepository;
    }

    @PostConstruct
    public void initData() {
        Tag tag = new Tag();
        tag.setName("test-tag");
        tag.setDescription("test");
        tag.setCreatedAt(LocalDateTime.parse("2025-05-11T16:56:35.75358"));
        tag.setUpdatedAt(LocalDateTime.parse("2025-05-11T16:57:50.2171153"));
        tagRepository.save(tag);
    }
}
